package com.serviceprovider.business.module.admin.faq.model;

//~--- JDK imports ------------------------------------------------------------

import java.text.DateFormat;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Question {
    private boolean  answer;
    private Category category;
    private boolean  confidential;
    private Date     created;
    private String   email;
    private boolean  faq_Question;
    private String   firstName;
    private int      id;
    private String   lastName;
    private String   orderNumber;
    private String   question;
    private String   questionFull;
    private String   refNumber;
    private String   subject;
    private String   tag;
    private int      topRank;
    private Date     updated;
    private int      userId;

    public Question() {
        category = new Category();
    }

    @Override
    public boolean equals(Object obj) {
        if ((obj == null) ||!(obj instanceof Question)) {
            return false;
        }

        Question b  = (Question) obj;
        boolean  eq = (id == b.id);

        if (!eq) {
            return false;
        }

        eq = (userId == b.userId);

        if (!eq) {
            return false;
        }

        eq = ((email == null) && (b.email == null)) || ((email != null) && email.equals(b.email));

        if (!eq) {
            return false;
        }

        eq = ((firstName == null) && (b.firstName == null)) || ((firstName != null) && firstName.equals(b.firstName));

        if (!eq) {
            return false;
        }

        eq = ((lastName == null) && (b.lastName == null)) || ((lastName != null) && lastName.equals(b.lastName));

        if (!eq) {
            return false;
        }

        eq = ((category == null) && (b.category == null)) || ((category != null) && category.equals(b.category));

        if (!eq) {
            return false;
        }

        eq = ((subject == null) && (b.subject == null)) || ((subject != null) && subject.equals(b.subject));

        if (!eq) {
            return false;
        }

        eq = ((questionFull == null) && (b.questionFull == null))
             || ((questionFull != null) && questionFull.equals(b.questionFull));

        if (!eq) {
            return false;
        }

        eq = ((orderNumber == null) && (b.orderNumber == null))
             || ((orderNumber != null) && orderNumber.equals(b.orderNumber));

        if (!eq) {
            return false;
        }

        eq = ((refNumber == null) && (b.refNumber == null)) || ((refNumber != null) && refNumber.equals(b.refNumber));

        if (!eq) {
            return false;
        }

        eq = ((created == null) && (b.created == null)) || ((created != null) && created.equals(b.created));

        if (!eq) {
            return false;
        }

        eq = ((updated == null) && (b.updated == null)) || ((updated != null) && updated.equals(b.updated));

        if (!eq) {
            return false;
        }

        eq = (topRank == b.topRank);

        if (!eq) {
            return false;
        }

        eq = ((tag == null) && (b.tag == null)) || ((tag != null) && tag.equals(b.tag));

        if (!eq) {
            return false;
        }

        eq = (confidential == b.confidential);

        if (!eq) {
            return false;
        }

        eq = (answer == b.answer);

        if (!eq) {
            return false;
        }

        eq = (faq_Question == b.faq_Question);

        if (!eq) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        int prime  = 31;
        int result = 1;

        result = prime * result + id;
        result = prime * result + userId;
        result = prime * result + ((email == null)
                                   ? 0
                                   : email.hashCode());
        result = prime * result + ((firstName == null)
                                   ? 0
                                   : firstName.hashCode());
        result = prime * result + ((lastName == null)
                                   ? 0
                                   : lastName.hashCode());
        result = prime * result + ((category == null)
                                   ? 0
                                   : category.hashCode());
        result = prime * result + ((subject == null)
                                   ? 0
                                   : subject.hashCode());
        result = prime * result + ((question == null)
                                   ? 0
                                   : question.hashCode());
        result = prime * result + ((questionFull == null)
                                   ? 0
                                   : questionFull.hashCode());
        result = prime * result + ((orderNumber == null)
                                   ? 0
                                   : orderNumber.hashCode());
        result = prime * result + ((refNumber == null)
                                   ? 0
                                   : refNumber.hashCode());
        result = prime * result + ((created == null)
                                   ? 0
                                   : created.hashCode());
        result = prime * result + ((updated == null)
                                   ? 0
                                   : updated.hashCode());
        result = prime * result + topRank;
        result = prime * result + ((tag == null)
                                   ? 0
                                   : tag.hashCode());
        result = prime * result + ((confidential == false)
                                   ? 0
                                   : 1);
        result = prime * result + ((answer == false)
                                   ? 0
                                   : 1);
        result = prime * result + ((faq_Question == false)
                                   ? 0
                                   : 1);

        return result;
    }

    public int getTopRank() {
        return topRank;
    }

    public void setTopRank(int topRank) {
        this.topRank = topRank;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getQuestion() {
        return question;
    }

    public void setQuestion(String question) {
        this.question = question;
    }

    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public Date getUpdated() {
        return updated;
    }

    public void setUpdated(Date updated) {
        this.updated = updated;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public boolean isConfidential() {
        return confidential;
    }

    public void setConfidential(boolean confidential) {
        this.confidential = confidential;
    }

    public String getConfidentialLabel() {
        return confidential
               ? "Yes"
               : "No";
    }

    public String getCreatedDatetime() {
        DateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        return dateFormater.format(created);
    }

    public String getUpdatedDatetime() {
        DateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        return dateFormater.format(updated);
    }

    public boolean isAnswer() {
        return answer;
    }

    public void setAnswer(boolean answer) {
        this.answer = answer;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getQuestionFull() {
        return questionFull;
    }

    public void setQuestionFull(String questionFull) {
        this.questionFull = questionFull;
    }

    public String getRefNumber() {
        return refNumber;
    }

    public void setRefNumber(String refNumber) {
        this.refNumber = refNumber;
    }

    public boolean isFaq_Question() {
        return faq_Question;
    }

    public void setFaq_Question(boolean faq_Question) {
        this.faq_Question = faq_Question;
    }
}



